/* ****************************************************************************
 *
 * Copyright (c) Microsoft Corporation. 
 *
 * This source code is subject to terms and conditions of the Microsoft Permissive License. A 
 * copy of the license can be found in the License.html file at the root of this distribution. If 
 * you cannot locate the  Microsoft Permissive License, please send an email to 
 * ironpy@microsoft.com. By using this source code in any fashion, you are agreeing to be bound 
 * by the terms of the Microsoft Permissive License.
 *
 * You must not remove this notice, or any other, from this software.
 *
 *
 * ***************************************************************************/

using System;
using System.Text;
using System.IO;
using System.Diagnostics;
using System.Collections.Generic;
using Microsoft.Scripting.Internal;
using Microsoft.Scripting.Hosting;
using Microsoft.Scripting;
using Microsoft.Scripting.Shell;
using Microsoft.Scripting.Internal.Generation;
using Nua;

namespace Nua.Hosting {

    sealed class NuaOptionsParser : OptionsParser {

        private NuaConsoleOptions _consoleOptions;
        private NuaEngineOptions _engineOptions;


        public override ConsoleOptions ConsoleOptions { get { return _consoleOptions; } set { _consoleOptions = (NuaConsoleOptions)value; } } 
        public override EngineOptions EngineOptions { get { return _engineOptions; } set { _engineOptions = (NuaEngineOptions)value; } }
        
        public NuaOptionsParser() 
        {
            GlobalOptions = new ScriptDomainOptions();
            // TODO:// temp hack to output an assembly
            GlobalOptions.DebugMode = true;
            GlobalOptions.AssemblyGenAttributes |= AssemblyGenAttributes.SaveAndReloadAssemblies;
            GlobalOptions.AssemblyGenAttributes |= AssemblyGenAttributes.ILDebug;
            GlobalOptions.Verbose |= true;

        }

        public override ConsoleOptions GetDefaultConsoleOptions() {
            return new NuaConsoleOptions();
        }

        public override EngineOptions GetDefaultEngineOptions() {
            return new NuaEngineOptions();
        }

     
        public override void Parse(string[] args) {
            if (_consoleOptions == null) _consoleOptions = new NuaConsoleOptions();
            if (_engineOptions == null) _engineOptions = new NuaEngineOptions();

            base.Parse(args);
        }

        /// <exception cref="Exception">On error.</exception>
        protected override void ParseArgument(string arg) 
        {
  
        }

        public override void GetHelp(out string commandLine, out string[,] options, out string[,] environmentVariables, out string comments) 
        {
            commandLine = "";
            options = new string[0,0];
            environmentVariables = new string[0,0];
            comments = "";

        }
    }
}